{template '_header'}

<div class="page-header">当前位置：<span class="text-primary">设备品牌管理</span></div>

<div class="page-content">
<form action="./index.php" method="get" class="form-horizontal" role="form" id="form1">
    <input type="hidden" name="c" value="site" />
    <input type="hidden" name="a" value="entry" />
    <input type="hidden" name="m" value="mx_shop" />
    <input type="hidden" name="do" value="web" />
    <input type="hidden" name="r" value="sgoods.brands" />

    <div class="page-toolbar">
        <div class="col-sm-4">
            <div class="pull-left">
                {ifp 'sgoods.brands.add'}
                <a class="btn btn-primary btn-sm" href="{php echo webUrl('sgoods/brands/post')}"><i class="fa fa-plus"></i> 添加设备品牌</a>
                {/if}
            </div>
            <div class="input-group-btn">
                <button class="btn btn-default btn-sm"  type="button" data-toggle='refresh'><i class='fa fa-refresh'></i></button>
                {ifp 'sgoods.brands.delete'}
                <button class="btn btn-default btn-sm" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{php echo webUrl('sgoods/brands/brandsdel')}"><i class='fa fa-trash'></i> 删除</button>
                {/if}
            </div>
        </div>


        <div class="col-sm-7 pull-right">

            <div class="input-group">
                <div class="input-group-select">
                <select name='status' class='form-control  input-sm select-md' style="width:100px;"  >
                    <option value="0" {if empty($status)} selected  {/if}>状态</option>
                    <option value="1" {if $status==1} selected  {/if}>显示</option>
                    <option value="2" {if $status==2} selected  {/if} >不显示</option>
                </select>
                </div>
                <input type="text" class="form-control input-sm"  name="keyword" value="{$_GPC['keyword']}" placeholder="品牌关键字"/>
                <span class="input-group-btn">
                    <button class="btn btn-sm btn-primary" type="submit"> 搜索</button>
                </span>
            </div>
        </div>
    </div>
</form>
{if count($list)>0}

<table class="table table-hover table-responsive">
    <thead class="navbar-inner" >
    <tr>
        <th style="width:25px;"><input type='checkbox' /></th>
        <th style='width:50px;'>id</th>
        <th style='width:110px;'>设备品牌名称</th>
        <th style='width:80px;'>logo</th>
        <th style='width:70px;'>状态</th>
        <th style='width:70px;'>操作</th>
    </tr>
    </thead>
    <tbody>
    {loop $list $row}
    <tr>

        <td>
            <input type='checkbox'   value="{$row['id']}"/>
        </td>

        <td >
            <span>{$row['id']}</span>
        </td>

        <td >
            <span>{$row['name']}</span>
        </td>

        <td >
            <img src="{php echo tomedia($row['logo'])}" style="width:70px;">
        </td>

        <td>
            <span class='label {if $row['status']==1}label-success{else}label-default{/if}'
            {ifp 'sgoods.brands.status'}
            data-toggle='ajaxSwitch'
            data-switch-value='{$row['status']}'
            data-switch-value0='0|不显示|label label-default|{php echo webUrl('sgoods/brands/status',array('status'=>1,'id'=>$row['id']))}'
            data-switch-value1='1|显示|label label-success|{php echo webUrl('sgoods/brands/status',array('status'=>0,'id'=>$row['id']))}'
            {/if}
            >
            {if $row['status']==1}显示{else}不显示{/if}</span>
        </td>
        <td  style="overflow:visible;">
            {ifp 'sgoods.brands.edit'}
            <div class="btn-group btn-group-sm">
                <a class="btn btn-default dropdown-toggle" href="{php echo webUrl('sgoods/brands/post', array('id'=>$row['id']))}"><i class="fa fa-edit"></i>编辑</a>
                {ifp 'sgoods.brands.delete'}
                <a data-toggle='ajaxRemove' href="{php echo webUrl('sgoods/brands/brandsdel', array('id'=>$row['id']))}" class="btn btn-default btn-sm" data-confirm="确认要删除品牌吗?"><i class="fa fa-trash"></i> 删除</a>
                {/if}
            </div>
            {/if}
        </td>
    </tr>
    {/loop}
    </tbody>
</table>
{$pager}

    {else}
    <div class="panel panel-default">
        <div class="panel-body empty-data">未查询到相关数据</div>
    </div>
    {/if}
</div>
<script language="javascript">

    require(['bootstrap'],function(){
        $("[rel=pop]").popover({
            trigger:'manual',
            placement : 'left',
            title : $(this).data('title'),
            html: 'true',
            content : $(this).data('content'),
            animation: false
        }).on("mouseenter", function () {
            var _this = this;
            $(this).popover("show");
            $(this).siblings(".popover").on("mouseleave", function () {
                $(_this).popover('hide');
            });
        }).on("mouseleave", function () {
            var _this = this;
            setTimeout(function () {
                if (!$(".popover:hover").length) {
                    $(_this).popover("hide")
                }
            }, 100);
        });
    });

</script>
{template '_footer'}